#include "mainwindow.h"
#include "ui_mainwindow.h"

#include "teacher.h"
#include "student.h"

MainWindow::MainWindow(QWidget *parent): QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    // 1. 创建两个类的实例
    Teacher teacher;
    Student student;

    // 2. 建立信号和槽的连接
    connect(&teacher, SIGNAL(go()), &student, SLOT(study()));
    connect(&teacher, SIGNAL(go(QString)), &student, SLOT(study(QString)));


    // 3. 发送信号
    emit teacher.go();
    emit teacher.go("自由");
}

MainWindow::~MainWindow()
{
    delete ui;
}
